function LoadSMILES
% This is the loader of the entire SMILES application, which makes some
% basic checks to see if SMILES will be able to run and runs SMILES if
% possible. Launching the SMILES application should always be done through
% this function.

%% Strings
debugstr = sprintf(['While in debugmode, run [rings main] = SMILES(input,0),'... 
    ' with input being a string. \nUI options: \nsmilesGUI(800) \nCMD(1)'...
    '\nPlease shut down the application by using the following functions: '...
    '\nqDebug']);

clc
%% Add Driver path
addpath('.\Core\Drivers')

%% Checks Free Space and loads Paths
if FreeSpace
    loadPaths;
    loadPtable;
    loadBaseCoor
    %% Asks user GUI or command
    reply = lower(input('Would you like to use our Graphical User Interface? yes/no [Yes]: ','s'));
    if isempty(reply)
        reply = 'yes';
    end
    switch(upper(reply))
        case {'YES','Y'}
            %% Runs with GUI
            disp('Starting GUI...')
            pause(0.5) %Pause to simulate a slow PC ;)
            [run adjust] = checkScreen;
            if run
                smilesGUI(adjust)
            else
                %% in case system requiresments are not met.
                str=sprintf(['Your screen does not meet the minimal '...
                    'screensize.\n \nSwitching to Commandwindow MODE...']);
                disp(str)
                pause(0.5) %Pause to simulate a slow PC ;)
                %% Runs in commandwindow
                CMD(1)
            end
            
        case {'NO','N'}
            %% Runs in commandwindow
            CMD(1)
            
        case 'DEBUG'
            %% debugmode
            disp(debugstr)          
            
    end
end



